<ul class="menu_ul" id="menu_ul">
<li class="now" id="menu_ma">
<a href="<?=SystemProperties::$app_url?>" target="_top">&nbsp;</a>
</li>
<li class="" id="menu_mb">
<a href="javascript:doChangePage('convert','menu_mb');">&nbsp;</a>
</li>
<?php if ('sina' != SystemProperties::$platform) { ?>
<li class="" id="menu_mg">
<a href="javascript:doChangePage('taobao','menu_mg');">&nbsp;</a>
</li>
<?php } ?>
<li class="" id="menu_md">
<a href="javascript:doChangePage('share','menu_md');">&nbsp;</a>
</li>
<li class="" id="menu_me">
<a href="javascript:doChangePage('wangqi','menu_me');">&nbsp;</a>
</li>
<li class="" id="menu_mf">
<a href="javascript:doChangePage('myluck', 'menu_mf');">&nbsp;</a>
</li>

</ul>

<script type="text/javascript"> 
var platfrom_base_req_url = "<?=SystemProperties::$app_host?>";

var need_fill_info = 0;
var check_js_var = 0;
var need_to_be_one = 0;
var clicktype = 0;
var xn_sig_session_key = <?=json_encode(empty($_REQUEST['xn_sig_session_key'])?'':$_REQUEST['xn_sig_session_key'])?>;
var is_user_login = <?=empty($_SESSION['user_id'])?0:1?>;

var now_page = 0;
var now_page_menu = 0;

function goSinaLoginFrame(type, pid) {
	type = !type?0:type;
	pid = !pid?0:pid;
	now_page = !now_page?0:now_page;
	now_page_menu = !now_page_menu?0:now_page_menu;
	document.location.href = platfrom_base_req_url+'/user/goLoginIframe/'+type+'/'+pid+'/'+now_page+'/'+now_page_menu;
}

function loadInLeft(url) {
    if (!$('userInfoDiv')) {
        $('content').innerHTML = <?=json_encode('<div class="left_content" id="mainDiv">
	</div>	
	<div class="right_content">
		<div id="userInfoDiv" class="right_userinfo" style="display:none"  >
		  <div class="loading_div"></div>
		</div>
		<div id="msgDynDiv" class="luckuser_bg_n">
		  <div class="loading_div"></div>
		</div>
		<div id="friendListDiv" class="friendlist_bg_n">
		  <div class="loading_div"></div>
		</div>
	</div>');?>;
    }
    doPost(url,'','mainDiv');
    loadRightContent();
}
function loadInAll(url) {
    doPost(url,'','content');
}

function goProduct(cat, p){
    cat = !cat?0:cat;
    p = !p?1:p;
    document.title = "开心赚宝";
    var url = "/user/productFreeList/"+cat+"?curPage="+p;
    loadInLeft(url);
}
function goFanli(page){
    document.title = "开心赚宝";
    var url = "/product/taobao/"+"?page="+page;
    loadInAll(url);
}
function goConvert(p){
    p = !p?1:p;
	document.title = "开心赚宝 - 积分兑换";
	var url ="/Product/getChangeProductList?curPage="+p;
	loadInLeft(url);
}

function goHelp(){
	document.title = "开心赚宝 - 帮助说明";
	var url ="/Product/tryHelp";
	loadInLeft(url);
}
function goTaobao(){
	document.title = "开心赚宝 - 分享返利";
	var url ="/Product/taobao";
	loadInAll(url);
}
function goShare(p, ids){
    p = !p?1:p;
    ids = !ids?'':ids;
	document.title = "开心赚宝 - 宝贝分享";
	var url ="/Product/getShare/"+p+'/'+ids;
	loadInAll(url);
}
function goMyluck(tab){
    tab = !tab?1:tab;
    hl_menu_li('menu_mf');
	document.title = "开心赚宝 - 我的专区";
	var url ="/user/myluck/"+tab;
	loadInAll(url);
}
function goWangqi(p){
     p = !p?1:p;
	document.title = "开心赚宝 - 往期回顾";
	var url ="/Product/wangqi/"+p;
	loadInLeft(url);
}
function goInvite(){
    hl_menu_li('');
	document.title = "开心赚宝 - 邀请好友";
	var url ="/user/showInvitationPage/";
	loadInAll(url);
}

function goInviteClick(){
    doChangePage('invite');
}

function addFollow() {
    doPost('/user/ajaxAddFollow', '' ,'');
}
function addFollowID(id) {
    doPost('/user/ajaxAddFollowUid/'+id, '' ,'');
}
function doChangePage(type, li) {

	//save the page
	now_page = type;
	now_page_menu = li;
	
    hl_menu_li(li);
    
    if (type == 'home') {
        refreshSelf();
        return;
    }

    switch (type) {
        case 'wangqi':goWangqi();break;
        case 'convert':goConvert();break;
        case 'convertdetails':goConvert();break;
        case 'myluck':
        if (!is_user_login) { goSinaLoginFrame('', 0); } else { goMyluck();}        
        break;
        case 'share':goShare();break;
        case 'help':goHelp();break;
        case 'invite':
        if (!is_user_login) { goSinaLoginFrame('', 0); } else { goInvite();}
        break;
        case 'product':goProduct();break;
        case 'details':goProduct();break;
		case 'taobao' : goTaobao(); break;
    }
}
<?php if (SystemProperties::$platform=='renren') { ?>
function sendFeed(msg){
	var feedSettings = {
		"template_bundle_id": 5,
		"template_data": {'title':'','content':''},
		"body_general": '',
		"callback": function(ok){console.log('here in feed callback!!');},
		"user_message_prompt": "分享一下吧：",
		"user_message": msg
	};
	XN.Connect.showFeedDialog(feedSettings);
}
<?php } else { ?>
function sendFeed(msg){
}
<?php } ?>
/*

///////////
getElementByClassW('NeedFillThisInput');
if empty error;
else save it .

*/

function check_lancome(){
	if (!$('hidden_lancome')){
		return true;
	}
	if ( ($('p_a') && getRadioValue('p_a')!=10)  ||
			($('p_b') && getRadioValue('p_b')!=7) ){
		alert('正确答案：10年、7项');
		return false;
	}

	return true;
}

function check_answer(question_id, answer_id, notify_id, url_id){
	if ($(question_id) && $(answer_id) && getRadioValue(question_id) != $(answer_id).get('value')){
		var msg;
		if ($(notify_id)){
			msg = $(notify_id).get('value');
		} else {
			msg = '回答错误，请重试';
		}
		alert(msg);
		if($(url_id)){
			window.open($(url_id).get('value'));
		}
		return false;
	}
	return true;
}

function tryOperatorzxWithoutPost(flag, url){

	var loading = document.getElementById('myConvertDoing');
	var bt = document.getElementById('myConvertBy');
	var info = document.getElementById('myConvertInfo');

	var special_html;
	var allNeedFillInput;
	if (document.getElementById('special_html' )){
		special_html = getFormAsString('special_html');
		//make sure not empty
		if (($('resideprovince') && $('resideprovince').value=='') ||($('residecity') && $('residecity').value=='')){
			alert('请完整选择省份及城市信息。');
			return  false;
		}

		if ( ($('p_a') && getRadioValue('p_a')=='')  ||
		($('p_b') && getRadioValue('p_b')=='') ){
			alert('请完整回答所有问卷内容。');
			return  false;
		}

		/* cy add, 2011-3-21 */
		if (!check_answer('p_a', 'p_a_a', 'p_notify', 'p_cy_url') || !check_answer('p_b', 'p_b_a', 'p_notify', 'p_cy_url')){
			return  false;
		}

		if(!check_lancome()){
			return  false;
		}
		
		allNeedFillInput = getElementByClassW('NeedFillThisInput');
		for (var i=0; i<allNeedFillInput.length; i++){
			if (allNeedFillInput[i].value == ''){
				alert('请完整回答所有问卷内容。');
				return false;
			}
			if (allNeedFillInput[i].name == 'EMail' && allNeedFillInput[i].value.indexOf('@')<0) {
			    alert('请正确填写您的邮箱地址，否则申请将视为无效。');
			    return false;
			}
			if (allNeedFillInput[i].name == 'IDCARD' ) {
			    len = allNeedFillInput[i].value.length;
			    if (len!=15 && len!=18) {
			        alert('请正确填写您的身份证号，否则申请将视为无效。');
			        return false;
			    }    			    
			}			
			
		}
		
		if (check_js_var && !need_to_be_one ){
		    if (clicktype==2) {
    		      alert('请您先点击关注产品官方微博，再进行申请。');
		    }else {
		         alert('请您先点击产品说明中的链接,了解产品后再进行申请。');
		    }
			return false;
		}


	}else {
		special_html = '';
	}

	var sendweibo = document.getElementById('check_sendweibo');
	if (sendweibo && sendweibo.checked) {
		url += '/1/';
	} else {
		url += '/0/';
	}
	window.open(url);
	return false;
}

function checkCodeWithLen(){
	if ($('p_code_limit') && $('p_code_len')){
		var val = $('p_code_limit').get('value'), len = $('p_code_len').get('value');
		if (val.length != len){
			alert('验证码错误');
			return false;
		}
	}
	return true;
}

function tryOperatorzx(flag){

	var url;
	var loading = document.getElementById('myConvertDoing');
	var bt = document.getElementById('myConvertBy');
	var info = document.getElementById('myConvertInfo');

	var special_html;
	var allNeedFillInput;
	if (document.getElementById('special_html' )){
		special_html = getFormAsString('special_html');
		//make sure not empty
		if (($('resideprovince') && $('resideprovince').value=='') ||($('residecity') && $('residecity').value=='')){
			alert('请完整选择省份及城市信息。');
			return ;
		}

		if ( ($('p_a') && getRadioValue('p_a')=='')  ||
		($('p_b') && getRadioValue('p_b')=='') ){
			alert('请完整回答所有问卷内容。');
			return ;
		}

		/* cy add, 2011-3-29, ugly code */
		if ($('p_code')){
			if(!$('p_code').get('value')){
				alert('请填写注册码');
				return ;
			}

			var ret = new Request({
					  url: '/Product/checkLankouCode',
					  data : {code: $('p_code').get('value')},
					  async:false
			  }).send();

			if (!ret.response.text || ret.response.text == 0){
				alert('注册码无效。请前去Lancome兰蔻玫瑰社区注册以获得注册码');
				return ;
			}
		}

		/* cy add, 2011-4-6 */
		if(!checkCodeWithLen()){
			return ;
		}

		/* cy add, 2011-3-21 */
		if (!check_answer('p_a', 'p_a_a', 'p_notify', 'p_cy_url') || !check_answer('p_b', 'p_b_a', 'p_notify', 'p_cy_url')){
			return ;
		}

		if(!check_lancome()){
			return ;
		}
		
		allNeedFillInput = getElementByClassW('NeedFillThisInput');
		for (var i=0; i<allNeedFillInput.length; i++){
			if (allNeedFillInput[i].value == ''){
				alert('请完整回答所有问卷内容。');
				return;
			}
			if (allNeedFillInput[i].name == 'EMail' && allNeedFillInput[i].value.indexOf('@')<0) {
			    alert('请正确填写您的邮箱地址，否则申请将视为无效。');
			    return;
			}
			if (allNeedFillInput[i].name == 'IDCARD' ) {
			    len = allNeedFillInput[i].value.length;
			    if (len!=15 && len!=18) {
			        alert('请正确填写您的身份证号，否则申请将视为无效。');
			        return;
			    }    			    
			}			
			
		}
		
		if (check_js_var && !need_to_be_one ){
		    if (clicktype==2) {
    		      alert('请您先点击关注产品官方微博，再进行申请。');
		    }else {
		         alert('请您先点击产品说明中的链接,了解产品后再进行申请。');
		    }
			return;
		}


	}else {
		special_html = '';
	}
	var sendweibo = document.getElementById('check_sendweibo');
	if (sendweibo && sendweibo.checked) {
	    document.getElementById('input_sendweibo').value = '1';
	} else {
	    document.getElementById('input_sendweibo').value = '0';
	}
	   
	document.getElementById('data_extra_id').value = encodeURIComponent(special_html);
	url = (flag==1)?'/Product/createApply':'/Product/createChange';
	loading.style.display = '';
	bt.style.display = 'none';
	info.style.display = 'none';
	doPost(url,'fms','myConvertInfo');
}

	document.domain='try8.info';
	var record_click = function(el, ckEl){
		if (!el){
			return;
		}
		var fid = el.getElement('.jFanliId').get('value'), weiboText = el.getElement('.jWeiboText').get('value'), weiboPic = el.getElement('.jWeiboPic').get('value');

		var url = "http://i.try8.info/tshare/direct/ri.php?action=inc_fanli_click&fid="+fid;
		url += '&r='+Math.random();
		var script = document.createElement('script');
		script.setAttribute('src', url);
		document.getElementsByTagName('head')[0].appendChild(script);

		if (!ckEl || !ckEl.get('checked')){
			return ;
		}

		if (!weiboText){
			return;
		}
		var url = "<?php echo SystemProperties::$app_url;?>/Product/sendweibo/"+weiboText+"/"+weiboPic;
		var script = document.createElement('script');
		script.setAttribute('src', url);
		document.getElementsByTagName('head')[0].appendChild(script);
	};
	var save_fanli_sendweibo = function(el){
		if (!el){
			return ;
		}
		var val = (el.get('checked')?'on':'');
		setCookie('fanliSendWeibo', val);
	};
	function setCookie(name, value, seconds) {  
		seconds = seconds || 0;   //seconds有值就直接赋值，没有为0，这个根php不一样。  
		var expires = "";  
		if (seconds != 0 ) {      //设置cookie生存时间  
			var date = new Date();  
			date.setTime(date.getTime()+(seconds*1000));  
			expires = "; expires="+date.toGMTString();  
		}  
		document.cookie = name+"="+escape(value)+expires+"; path=/";   //转码并赋值  
	}  

</script>
